package com.xdb.sqlparser.dialect.oracle.ast.statement;

import com.xdb.sqlparser.ast.SQLName;
import com.xdb.sqlparser.ast.statement.SQLCheck;
import com.xdb.sqlparser.dialect.oracle.ast.OracleSQLObject;
import com.xdb.sqlparser.dialect.oracle.visitor.OracleASTVisitor;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class OracleCheck extends SQLCheck implements OracleConstraint, OracleSQLObject {

	private OracleUsingIndexClause using;
	private SQLName exceptionsInto;
	private Initially initially;
	private Boolean deferrable;

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor instanceof OracleASTVisitor) {
			accept0((OracleASTVisitor) visitor);
			return;
		}

		super.accept(visitor);
	}

	public void accept0(OracleASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, this.getName());
			acceptChild(visitor, this.getExpr());

			acceptChild(visitor, using);
			acceptChild(visitor, exceptionsInto);
		}
		visitor.endVisit(this);
	}

	public Boolean getDeferrable() {
		return deferrable;
	}

	public void setDeferrable(Boolean deferrable) {
		this.deferrable = deferrable;
	}

	public Initially getInitially() {
		return initially;
	}

	public void setInitially(Initially initially) {
		this.initially = initially;
	}

	public SQLName getExceptionsInto() {
		return exceptionsInto;
	}

	public void setExceptionsInto(SQLName exceptionsInto) {
		this.exceptionsInto = exceptionsInto;
	}

	public OracleUsingIndexClause getUsing() {
		return using;
	}

	public void setUsing(OracleUsingIndexClause using) {
		if (using != null) {
			using.setParent(this);
		}
		this.using = using;
	}

}
